<template>
	<view>
		<u-tabs :list="tabslist" :scrollable="false" lineColor="#c1282e" @click="changetab"
			:activeStyle="{
		    color: '#c1282e',
		    fontWeight: 'bold',
		    transform: 'scale(1.05)'
		}" :inactiveStyle="{
		            color: '#333333',
					fontWeight: '540',
		            transform: 'scale(1)'
		        }" itemStyle="padding-left: 10px; padding-right: 10px; height: 44px;"></u-tabs>
		<view class="mainpadding2">
			<view class="mainpadding_top ffffff radius" v-for="item in list.data" :key="item.id">
				<view class="xiaohui ershiba ">申请人：{{item.user.username}}</view>
				<view class="xiaohui ershiba margin_top2">原因：{{item.reason}}</view>
				<view class="flexleft flex_wrap" v-if="item.images!=''">
					<view class="flexcenter margin_top2" style="width: 25%;" v-for="(ite,ind) in item.images_text" :key="ind" @click="lbtpriview(ind,item.images_text)">
						<view class="tupian dingwei">
							<image :src="ite" mode=""></image>
						</view>
					</view>
				</view>
				<view class="flexright margin_top2" v-if="item.status==1">
					<view class="flexleft trashbtn" @click="currentid=item.id;show=true">
						<u-icon name="file-text" color="#c1282e" size="16"></u-icon>
						<view class="xiaohong margin_left1 main_size">审核</view>
					</view>
				</view>
			</view>
		</view>
		<u-modal :show="show" title="审核" confirmText="确认" confirmColor="#FF5C00" @confirm="confirm" cancelText="取消"
			@cancel="show=false" showCancelButton>
			<view class="slot-content" style="width: 600rpx;">
				<view class="flexbetween margin_top">
					<view class="main_size bold hei_text">操作：</view>
					<u-radio-group v-model="status" placement="row" circle>
						<u-radio activeColor="#feb800" :customStyle="{marginRight: '10rpx'}" label="通过"
							name="2"></u-radio>
						<u-radio activeColor="#feb800" label="驳回" name="3"></u-radio>
					</u-radio-group>
				</view>
			</view>
		</u-modal>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				tabsid: 1,
				tabslist: [{
					name: '待处理',
					value: 1,
				}, {
					name: '已处理',
					value: 2,
				}, {
					name: '已驳回',
					value: 3,
				}],
				currentid:"",
				show:false,
				status:"2"
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			confirm(){
				this.show = false
				httpRequest.request('/api/Companydk/applyCompanyDkbk', 'GET', {
					id: this.currentid,
					status:this.status
				}, false, false, true).then(res => {
					httpRequest.toast(res.msg)
					if (res.code == 1) {
						this.init()
					}
				})
			},
			init(isPage, page) {
				let _this = this
				httpRequest.request('/api/Companydk/companyDkbkIndex', 'GET', {
					page: page || 1,
					limit: _this.limit,
					status: this.tabsid,
					ly: 2
				}).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			changetab(e) {
				this.tabsid = e.value
				this.init()
			},
		}
	}
</script>

<style lang="scss" scoped>
.tupian {
		width: 147rpx;
		height: 147rpx;
		border-radius: 14rpx;

		image {
			width: 147rpx;
			height: 147rpx;
			border-radius: 14rpx;
		}
	}
	.editbtn {
		padding: 10rpx 30rpx;
		border-radius: 10rpx;
		background-color: #c1282e;
	}
	.trashbtn {
		padding: 10rpx 30rpx;
		border-radius: 10rpx;
		border: 1rpx solid #c1282e;
	}
</style>